// pages/mine/yaoqing/yaoqing.js
const $api = require("../../../api/mine").API
Page({

  /**
   * 页面的初始数据
   */
  data: {
    familyList:''
  },
  //跳转增加页面
  add:function(){
    wx.navigateTo({
      url: '/pages/mine/yaoqing/add/add',
      success: (result)=>{
        
      },
      fail: ()=>{},
      complete: ()=>{}
    });
  },
  onShow(e){
    var t = this,
    userinfo = wx.getStorageSync('user'),
    child_one = wx.getStorageSync('child_one'),
    data={
      'member_id':userinfo.member_id,
      'child_id':child_one.child_id
    }
    $api.getFamilyInvitation(data).then(res=>{
      console.log(res)
      t.setData({
        'familyList':res.data
      })
    })
  },
  //解绑
  jiebang(e){
    var t = this,
<<<<<<< HEAD
    dict_key = e.currentTarget.dataset.index,
=======
    dict_key = e.currentTarget.dataset['index'],
>>>>>>> 1c9ce1fdc7fcbf1a028b999eb3cd07f698a8a329
    data={
      'parental_child_id':dict_key
    }
    $api.deleteFamilyParent(data).then(res=>{
      console.log(res)
      if(res.status==200){
        wx.showToast({
          title: '解绑成功',
        })
        setTimeout(function(){
          t.onShow()
        },1000)
      }
    })
<<<<<<< HEAD
  },
=======
  }
>>>>>>> 1c9ce1fdc7fcbf1a028b999eb3cd07f698a8a329
})